/*
 * JBoss, Home of Professional Open Source
 *
 * Copyright 2008, Red Hat Middleware LLC, and individual contributors
 * by the @author tags. See the COPYRIGHT.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jboss.netty.handler.codec.bayeux;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;

/**
 * A Bayeux server MUST respond to a connect request with a connect response
 * message over the same transport as used for the request.
 *
 * A Bayeux server MAY wait to respond until there are event messages available
 * in the subscribed channels for the client that need to be delivered to the
 * client.
 *
 * A connect responses MUST contain the message fields:
 *   channel
 *     value "/meta/connect"
 *   successful
 *     boolean indicating the success or failure of the connection
 *   clientId
 *     The negotiated client ID
 *
 * A connect response MAY contain the message fields:
 *   error
 *   advice
 *   ext
 *   id
 *     same value as request message id
 *   timestamp
 *
 * An example connect response is:
 * [
 *   {
 *      "channel": "/meta/connect",
 *      "successful": true,
 *      "error": "",
 *      "clientId": "Un1q31d3nt1f13r",
 *      "timestamp": "12:00:00 1970",
 *      "advice": { "reconnect": "retry" }
 *    }
 * ]
 *
 * The client MUST maintain only a single outstanding connect message. If the
 * server does not have a current outstanding connect and a connect is not
 * received within a configured timeout, then the server SHOULD act as if a
 * disconnect message has been received.
 * 
 * @author daijun
 */
public class ConnectResponse extends BayeuxMessage {

    //required
    //private String channel;
    //private boolean successful;
    //private String clientId;
    //optional
    //private String error;
    //private BayeuxAdvice advice;
    //private BayeuxExt ext;
    //private String id;
    //private String timestamp;
    public ConnectResponse(ConnectRequest request) {
        this.channel = "/meta/connect";
        this.successful = true;
        this.clientId = request.clientId;
        this.ext = request.ext;
        this.id = request.id;

    }

    @Override
    public boolean isValid() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
